/*
\ brief:  实现文件
\ author: 清晨与猫鱼
*/
#include <iostream>     // 标准输入输出库
#include <memory>       // 内存管理库
#include <string>           

using namespace std;

/*
\ brief:   形状抽象类
\ author: 清晨与猫鱼
*/
class Shape {
public:
    virtual void draw() = 0;        // 虚函数绘制接口
};


/*
\ brief:  长方形
\ author: 清晨与猫鱼
*/
class Rectangle 
    : public Shape {
public:
    void draw() {
        cout << "Rectangle::draw()" << endl;
    }
};


/*
\ brief:  正方形
\ author: 清晨与猫鱼
*/
class Square 
    : public Shape {
public:
    void draw()  {
        cout << "Square::draw()" << endl;
    }
};


/*
\ brief:  圆形
\ author: 清晨与猫鱼
*/
class Circle 
    : public Shape {
public:
    void draw()  {
        cout << "Circle::draw()" << endl;
    }
};


/*
\ brief:  形状制作人
\ author: 清晨与猫鱼
*/
class ShapeMaker {
public:
    explicit ShapeMaker() 
        : circle_(new Circle), rectangle_(new Rectangle), square_(new Square){
    }

/*
\ brief:   绘制圆形
\ author: 清晨与猫鱼
*/
    void drawCircle() {
        circle_->draw();
    }

/*
\ brief:   绘制长方形
\ author: 清晨与猫鱼
*/
    void drawRectangle() {
        rectangle_->draw();
    }

/*
\ brief:  绘制正方形
\ author: 清晨与猫鱼
*/
    void drawSquare() {
        square_->draw();
    }
private:
    unique_ptr<Shape> circle_;          // 圆形
    unique_ptr<Shape> rectangle_;       // 长方形
    unique_ptr<Shape> square_;          // 正方形
};